home *** CD-ROM | disk | FTP | other *** search
- function skipOptions(){
- try{
- skipWin = window.openDialog('chrome://skipscreen/content/options.xul', 'SkipScreen Options', 'chrome,titlebar,toolbar,centerscreen,resizable');
- skipWin.focus();
- } catch (e) {
- alert(e);
- }
- return true;
- }//skipOptions()
-
- function skipAbout(){
- try{
- skipWin = window.openDialog('chrome://skipscreen/content/about.xul', 'SkipScreen About', 'chrome,titlebar,toolbar,centerscreen,resizable');
- skipWin.focus();
- } catch (e) {
- alert(e);
- }
- return true;
- }
-
-
-
- // https://developer.mozilla.org/en/Code_snippets/On_page_load#Running_code_on_an_extension%27s_first_run_or_after_an_extension%27s_update
-
- var Overlay = {
- init: function(){
-
- var prev = -1, firstrun = true;
- var skipdate = ""; var dateNotSet = true;
-
- // no need for this var to be in the global name-space
- // NOR to share a potentiall common name. so, ssPrefs
- var ssPrefs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefService);
- ssPrefs = ssPrefs.getBranch("extensions.skipscreen.");
-
- var gExtensionManager = Components.classes["@mozilla.org/extensions/manager;1"]
- .getService(Components.interfaces.nsIExtensionManager);
- var current = gExtensionManager.getItemForID("SkipScreen@SkipScreen").version;
- //gets the version number.
-
- try{
- prev = ssPrefs.getCharPref("version");
- firstrun = ssPrefs.getBoolPref("firstrun");
- skipdate = ssPrefs.getCharPref("firstskipdate");
- dateNotSet = (skipdate == "");
- }catch(e){
- //nothing
- }finally{
-
- // TODO: build a debug preference, that floods the user with messages like these
- // without the need for code-modification....
- // for debugging only, naturally!
- // alert("current: " + current + "\nprev: " + prev + "\nfirstrun : " + firstrun + "\nskipdate: " + skipdate );
-
- if (dateNotSet) {
- ssPrefs.setCharPref("firstskipdate", Date());
- }
-
- if (firstrun){
- ssPrefs.setBoolPref("firstrun",false);
- ssPrefs.setCharPref("version",current);
-
- // Insert code for first run here
- window.setTimeout(function(){
- gBrowser.selectedTab = gBrowser.addTab("http://www.skipscreen.com/whatsnew.html?ver="+current);
- }, 1500); //Firefox 2 fix - or else tab will get closed (leave it in....)
-
- }
-
- if (prev!=current && !firstrun){ // !firstrun ensures that this section does not get loaded if its a first run.
- ssPrefs.setCharPref("version",current);
-
- // version is different => upgrade (or conceivably downgrade)
- window.setTimeout(function(){
- gBrowser.selectedTab = gBrowser.addTab("http://www.skipscreen.com/whatsnew.html?ver=" + current
- + "&prev=" + prev);
- }, 1500); //Firefox 2 fix - or else tab will get closed
-
- }
- } // end finally
-
- window.removeEventListener("load",function(){ Overlay.init(); },true);
- }
- };
-
- // fires on browser launch, which includes open-link-in-new-window
- window.addEventListener("load",function(){ Overlay.init(); },true);
-